Напишите класс, который, получив строку, будет возвращать строку в верхнем регистре, в которой каждая буква сдвинута вперед в алфавите на столько позиций, на которые был инициализирован шифр.
Примеры
c = CaesarCipher(5) # создаётся шифр Цезаря со сдвигом 5 c.encode('Codewars') # возвращает 'HTIJBFWX' c.decode('BFKKQJX') # возвращает 'WAFFLES'
Если что-то в строке не соответствует алфавиту (например, знаки препинания, пробелы), просто оставьте как есть. Сдвиг всегда будет в диапазоне [1, 26] английских букв(по желанию можно написать и второй класс для русского алфавита, диапазон [1, 33]).
Свой вариант решения в комментарии 💭 Кодом делиться через pastebin.org или repl.it.
Напишите класс, который, получив строку, будет возвращать строку в верхнем регистре, в которой каждая буква сдвинута вперед в алфавите на столько позиций, на которые был инициализирован шифр.
Примеры
c = CaesarCipher(5) # создаётся шифр Цезаря со сдвигом 5 c.encode('Codewars') # возвращает 'HTIJBFWX' c.decode('BFKKQJX') # возвращает 'WAFFLES'
Если что-то в строке не соответствует алфавиту (например, знаки препинания, пробелы), просто оставьте как есть. Сдвиг всегда будет в диапазоне [1, 26] английских букв(по желанию можно написать и второй класс для русского алфавита, диапазон [1, 33]).
Свой вариант решения в комментарии 💭 Кодом делиться через pastebin.org или repl.it.
#задачи
BY Python Turbo. Уютное сообщество Python разработчиков.
Bitcoin is a decentralized digital currency that you can buy, sell and exchange directly, without an intermediary like a bank. Bitcoin’s creator, Satoshi Nakamoto, originally described the need for “an electronic payment system based on cryptographic proof instead of trust.” Each and every Bitcoin transaction that’s ever been made exists on a public ledger accessible to everyone, making transactions hard to reverse and difficult to fake. That’s by design: Core to their decentralized nature, Bitcoins aren’t backed by the government or any issuing institution, and there’s nothing to guarantee their value besides the proof baked in the heart of the system. “The reason why it’s worth money is simply because we, as people, decided it has value—same as gold,” says Anton Mozgovoy, co-founder & CEO of digital financial service company Holyheld.
Newly uncovered hack campaign in Telegram
The campaign, which security firm Check Point has named Rampant Kitten, comprises two main components, one for Windows and the other for Android. Rampant Kitten’s objective is to steal Telegram messages, passwords, and two-factor authentication codes sent by SMS and then also take screenshots and record sounds within earshot of an infected phone, the researchers said in a post published on Friday.
Python Turbo Уютное сообщество Python разработчиков from vn